textview: Fix clip usage
authorJosé Aliste <jaliste@src.gnome.org>
Sun, 3 Oct 2010 10:14:48 +0000 (12:14 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 3 Oct 2010 10:30:30 +0000 (12:30 +0200)
The previous code used cairo_clip_extents() and interpreted its
parameters wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=631203

gtk/gtktextdisplay.c

index 93be053064ee8045a0edd6d61a71986f48b2241d..782ee14bb1f89688ad9ce76d3ad282f00e373bcd 100644 (file)
@@ -810,16 +810,17 @@ gtk_text_layout_draw (GtkTextLayout *layout,
   GSList *line_list;
   GSList *tmp_list;
   GList *tmp_widgets;
-  double x, y, width, height;
+  GdkRectangle clip;
   
   g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
   g_return_if_fail (layout->default_style != NULL);
   g_return_if_fail (layout->buffer != NULL);
   g_return_if_fail (cr != NULL);
 
-  cairo_clip_extents (cr, &x, &y, &width, &height);
+  if (!gdk_cairo_get_clip_rectangle (cr, &clip))
+    return;
 
-  line_list =  gtk_text_layout_get_lines (layout, y, y + height, &current_y);
+  line_list =  gtk_text_layout_get_lines (layout, clip.y, clip.y + clip.height, &current_y);
 
   if (line_list == NULL)
     return; /* nothing on the screen */